/*
 * @Author: 李小晴 2689279066@qq.com
 * @Date: 2023-03-16 10:34:03
 * @LastEditors: 李小晴 2689279066@qq.com
 * @LastEditTime: 2023-04-11 11:21:19
 * @FilePath: \sys\src\api\dept\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { useAxios } from '@/hooks/web/useAxios'
import type { TableData } from './types'
const request = useAxios()

import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()

// 部门列表
export const adminDeptListApi = (data: TableData) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminDeptList',
      data: data
    }
  })
}

// 部门修改
export const adminDeptEditApi = (data: TableData) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminDeptEdit',
      data: data
    }
  })
}

// 部门新增
export const adminDeptAddApi = (data: TableData) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminDeptAdd',
      data: data
    }
  })
}

// 部门删除
export const adminDeptDelApi = (data: { dept_id?: number | string }) => {
  return request.post({
    url: 'https://api.user.grazlink.com/index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminDeptDel',
      data: data
    }
  })
}
